# 1. for 循环条件测试
cars = ['audi', 'bmw', 'SUBARU', 'toyota']
for car in cars:
    if car == 'bmw':
        print(car.upper()) # 转成大写
    elif car == 'SUBARU':
        print(car.lower()) # 转成小写
    elif car != 'audi':
        print(car.title())
    else:
        print(car)

# 2. 使用 and 或者 or 检查条件
l1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
for i in l1:
    if (i > 1 and i < 3): # 前后的条件必须全部满足
        print(i)

for i in l1:
    if (i < 3 or i > 5): # 只满足一个即可
        print(i)


# 3.检查指定的元素是否在列表中
print(2 in l1) # True
print(20 in l1) # False
print(20 not in l1) # True

# 4.检查列表不为空
num = []
if num:
    for i in num:
        print(i)
else:
    print("num is empty!")

# 5.使用多个列表
num1 = [1, 2, 3, 4, 5]
num2 = ["a", 'b', 'c', 'd', 'e']
for i in num1:
    for j in num2:
        print(str(i) + j)